<script setup lang="ts">
import { ref } from 'vue'
import mammoth from 'mammoth'

const onChange = (_e: Event): void => {
	const file = (_e.target as HTMLInputElement).files?.[0]
	const reader = new FileReader()

	reader.onload = () => {
		const arrayBuffer = reader.result as ArrayBuffer
		void mammoth.convertToHtml({ arrayBuffer }).then((res) => {
			console.log(res)
		})
	}
	reader.readAsArrayBuffer(file as Blob)
	// void mammoth.extractRawText({ path: file }).then((res) => {
	// 	console.log(res)
	// })
}
</script>

<template>
	<input type="file" @change="onChange" />
</template>
